package com.chang.cheng.toutiaoserver;

import com.chang.cheng.toutiaoserver.utils.LocalDateUtil;
import org.junit.jupiter.api.Test;

import java.sql.Timestamp;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Year;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Random;

import static java.time.LocalTime.now;

/**
 * @Auther: asus
 * @Date: 2022/01/03 09:56
 * @Description:
 */
public class test {
    @Test
    public void test220103 ()throws Exception{
//        LocalDateTime data=LocalDateTime.now();
//        DateTimeFormatter dtf7 = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
//        String strDate7 = dtf7.format(data);
//        Long longDate = Long.parseLong(strDate7);
//        LocalDate LD=LocalDate.now();
//        String s = LocalDateUtil.localDateToString(LD);//2022-01-03

//        String format = String.format("%06d", 22);
//        Long l= null;
//        try {
//            l = Long.parseLong("6q66");
//        } catch (NumberFormatException e) {
//
//        }
//        String format = String.format("%06d", 22);
//        System.out.println(format);
        //获取秒数
        Long second = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"));
        //获取毫秒数
        Long milliSecond = LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli();
//
//        System.out.println(second);
//        System.out.println(milliSecond);
//        System.out.println(new Date().getTime());
//        Long timestamp = LocalDateUtil.stringTOTimeStamp("2019-08-27 08:02:00");
//        System.out.println(timestamp);
        Long aLong = LocalDateUtil.stringTOTimeStamp("2019-08-27 07:56:44");
        String s = LocalDateUtil.stampToString(1641610643651L);
        System.out.println(s);

    }
}
